<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var iframeHasLoadedFirstPage = false;

function runTest()
{
    if (!iframeHasLoadedFirstPage) {
        iframeHasLoadedFirstPage = true;

        shouldBe("document.getElementById('theFrame').contentDocument.baseURI", "document.baseURI");
        var iframe = document.getElementById('theFrame');
        iframe.src = "javascript:document.location.replace('./resources/iframe-no-src-set-location-pass.html')";
    } else {
        shouldBe("document.getElementById('theFrame').contentDocument.body.innerHTML", "'PASS\\n'");

        isSuccessfullyParsed();

        if (window.testRunner) {
            testRunner.notifyDone();
        }
    }
}

</script>
</head>
<body>
<script>
description("This tests that an iframe with no src attribute uses the parent document's URL as a base when resolving non-fully-qualified URLs set by JavaScript.");
</script>
<iframe id="theFrame" onload="runTest()"></iframe>
</body>
</html>
